package datastruct.set;

import datastruct.lineList.LinkList;

/**
 * @author RunningShrimp
 * @date 2021/5/17  10:35
 * @see <a href=""></a>
 */
public class LinkedListSet<E> implements Set<E> {
    private final LinkList<E> list;

    public LinkedListSet() {
        list = new LinkList<>();
    }

    @Override
    public void add(E e) {
        if(!list.contains(e)){
            list.add(e);
        }
    }

    @Override
    public void remove(E e) {
        list.remove(e);
    }

    @Override
    public boolean contains(E e) {
        return list.contains(e);
    }

    @Override
    public int getSize() {
        return list.size();
    }

    @Override
    public boolean isEmpty() {
        return list.isEmpty();
    }
}
